// paths
var WEB_BASE_PATH = "/livcos.org/web";
var EDIT_BASE_PATH = WEB_BASE_PATH+"/editor";
var EDIT_JOB_URL = "/Edit.job";
var EDIT_SNAPSHOT_URL = "/Snapshot.job";
var EDIT_TRANSFORM_URL = "/Transform.job";
var EDIT_HISTORY_URL = "/History.job";
var EDIT_CLIPBOARD_JOB_URL = "/clipboard/Edit.job";
var EDIT_SCRIPT_BASE = WEB_BASE_PATH+"/script";
var EDIT_IMAGE_BASE = WEB_BASE_PATH+"/img";

// initial page setup
new EventListener(window, "load", function(evn) {
	scriptSupport.init();
  var doc = Doc(document);
  if (doc.contentPanel) {
	  // check for old documents
	  var servedDateMeta = doc.getMeta("served");
	  if (servedDateMeta) {
	    var d = Date.parseXsDateTime(servedDateMeta.content);
	    if (((new Date()) - d) > 5000) {
		  	var v = encodeURIComponent(doc.getViewUri());
	      var r = new Resource(BasePath.get()+WEB_BASE_PATH+"/xml?ref="+v);
	      r._contentPanel = doc.contentPanel;
	      r.onCompleted = function() {
				  this._contentPanel.merge(this.dom.getElementsByTagName("div")[0], true);
	        StatusDisplay.getInstance().show("...page updated.", null, true);
	      };
	      r.load();
	    }
	  }
  }
});

	